package cn.chendd.plugins.sidebar;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.JBColor;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

/**
 * @author chendd
 * @date 2024/1/4 17:49
 */
public class HelloSidebarFrame implements ToolWindowFactory {

    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {

        final ContentFactory factory = ContentFactory.getInstance();
        {
            JPanel panel = new JPanel();
            JLabel label = new JLabel("Hello chendd");
            label.setFont(new Font("宋体", Font.BOLD, 32));
            label.setForeground(JBColor.BLUE);
            panel.add(label);
            final Content content1 = factory.createContent(panel, "chendd", false);
            toolWindow.getContentManager().addContent(content1);
        }
        {
            JPanel panel = new JPanel();
            JLabel label = new JLabel("Hello world");
            label.setFont(new Font("宋体" , Font.BOLD , 32));
            label.setForeground(JBColor.RED);
            panel.add(label);
            final Content content1 = factory.createContent(panel, "world", true);
            toolWindow.getContentManager().addContent(content1);
        }
    }
}
